#!/usr/bin/env ansible-playbook
---
- hosts: localhost
  vars:
    ansible_ask_become_pass: true
    configs:
    - alacritty
    - lf
    - mpv
    - pass-git-helper
    - flameshot
    - zathura

  tasks:
  - name: "Create symlink for NeoVim configuration"
    ansible.builtin.file:
      src: "{{ playbook_dir }}/config/{{ item }}"
      dest: "~/.config/{{ item }}"
      state: link
      owner: 1000
      group: 1000
    loop: "{{ configs }}"

  - name: "Install lf file-browser"
    kewlfft.aur.aur:
      name: lf-bin
      state: latest
    become: yes
    become_user: aur_builder

  - name: "Install CTPV Git"
    kewlfft.aur.aur:
      name: ctpv-git
      state: latest
    become: yes
    become_user: aur_builder

  - name: "Install Archivemount"
    kewlfft.aur.aur:
      name: archivemount
      state: latest
    become: yes
    become_user: aur_builder

  - name: "Install Common GUI tools"
    community.general.pacman:
      name:
      - alacritty # A cross-platform, GPU-accelerated terminal emulator
      - flameshot # Powerful yet simple to use screenshot software
      - gparted # A Partition Magic clone, frontend to GNU Parted
      - mpv # a free, open source, and cross-platform media player
      - zathura # Minimalistic document viewer
      - zathura-pdf-mupdf # PDF support for Zathura (MuPDF backend) (Supports PDF, ePub, and OpenXPS)
      - zathura-ps # Adds ps support to zathura by using the libspectre library
      update_cache: yes
      state: latest
    become: yes

  - name: "Install Pass"
    community.general.pacman:
      name:
      - pass # Stores, retrieves, generates, and synchronizes passwords securely
      - pass-otp # A pass extension for managing one-time-password (OTP) tokens.
      state: latest
    become: yes

  - name: "Install Gopass"
    community.general.pacman:
      name:
      - gopass # The slightly more awesome standard unix password manager for teams.
      - gopass-jsonapi # jsonapi for gopass used for bridging to browsers
      - git-credential-gopass # git-credentials helper for gopass
      - zbar # Application and library for reading bar codes from various sources
      state: latest
    become: yes

  - name: "Install pass-git-helper"
    kewlfft.aur.aur:
      name: pass-git-helper
      state: latest
    become: yes
    become_user: aur_builder

  - name: "Install Opera"
    community.general.pacman:
      name:
      - opera # A fast and secure web browser
      - opera-ffmpeg-codecs # additional support for proprietary codecs for opera
      - browserpass # Native host app for Browserpass, browser extension for zx2c4's pass (password manager)
      - browserpass-chromium # Chromium extension for Browserpass, browser extension for zx2c4's pass (password manager)
      state: latest
    become: yes

  - name: "Install Firefox"
    community.general.pacman:
      name:
      - firefox
      state: latest
    become: yes

  - name: "Make browserpass host config"
    make:
      chdir: /usr/lib/browserpass
      target: hosts-chrome-user

  - name: "Install Messengers"
    community.general.pacman:
      name:
      - telegram-desktop # Official Telegram Desktop client
      - element-desktop # Glossy Matrix collaboration client — desktop version.
      - discord # All-in-one voice and text chat for gamers
      state: latest
    become: yes

  - name: "Install Slack"
    kewlfft.aur.aur:
      name: slack-desktop # Slack Desktop (Beta) for Linux
      state: latest
    become: yes
    become_user: aur_builder

  - name: "Install Skype"
    kewlfft.aur.aur:
      name: skypeforlinux-stable-bin # Skype for Linux - Stable/Release Version
      state: latest
    become: yes
    become_user: aur_builder

  - name: "Install Thunderbird"
    community.general.pacman:
      name:
      - thunderbird # Standalone mail and news reader from mozilla.org
      - thunderbird-i18n-ru # Russian language pack for Thunderbird
      - thunderbird-i18n-en-us # English (US) language pack for Thunderbird
      state: latest
    become: yes

  - name: "Install tfswitch"
    kewlfft.aur.aur:
      name: tfswitch-bin
      state: latest
    become: yes
    become_user: aur_builder

  - name: "Install Postman"
    kewlfft.aur.aur:
      name: postman-bin
      state: latest
    become: yes
    become_user: aur_builder

  - name: "Install Git Extras"
    kewlfft.aur.aur:
      name: git-extras
      state: latest
    become: yes
    become_user: aur_builder

  - name: "Install Transmission"
    community.general.pacman:
      name:
      - transmission-cli # Fast, easy, and free BitTorrent client (CLI tools, daemon and web client)
      state: latest
    become: yes

  - name: "Add current user to transmission group"
    ansible.builtin.user:
      name: "{{ ansible_user_id }}"
      groups: transmission
      append: yes
    become: yes
...
